package ctrl;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.ArrayList;

import org.jnativehook.GlobalScreen;
import org.jnativehook.NativeHookException;
import org.jnativehook.keyboard.NativeKeyEvent;
import org.jnativehook.keyboard.NativeKeyListener;
import org.jnativehook.mouse.NativeMouseEvent;
import org.jnativehook.mouse.NativeMouseInputListener;
import org.jnativehook.mouse.NativeMouseWheelEvent;
import org.jnativehook.mouse.NativeMouseWheelListener;

import model.getInfo;

public class infoCtrl implements NativeMouseInputListener, NativeMouseWheelListener, WindowListener, NativeKeyListener{
	
	private static getInfo info;
	private static infoCtrl instance = null;
	private ArrayList<getInfo> inf = new ArrayList<getInfo>();
	
	private static infoCtrl getInstance()
	{
		if(instance == null)
		{
			instance = new infoCtrl();
		}
		return instance;
	}
	
	public infoCtrl()
	{
		info = new getInfo();
	
		
	}
	public void cleanUp()
	{
		info.cleanUp();
	}
	public ArrayList<getInfo> getInf() {
		return inf;
	}
	public boolean getDone()
	{
		return info.isDone();
	}
	public void setDone(boolean done)
	{
		info.setDone(done);
	}

	public void setInfo(getInfo inf)
	{
		info = inf;
	}
	public getInfo getInfor()
	{
		return info;
	}
	public int getWheelDir()
	{
		return info.getWheelDir();
	}
	public void setWheelDir(int wheelDir)
	{
		info.setWheelDir(wheelDir);
	}
	public int getWheelAmount()
	{
		return info.getWheelAmount();
	}
	public void setWheelAm(int wheelAmount)
	{
		info.setWheelAmount(wheelAmount);
	}
	public boolean isLeftClickPressed()
	{
		return info.isLeftClickPress();
	}
	public void setLeftClickPress(boolean leftClickPress)
	{
		info.setLeftClickPress(leftClickPress);
	}
	public boolean isRightClickPressed()
	{
		return info.isRightClickPress();
	}
	public void setRightClickPress(boolean rightClickPress)
	{
		info.setRightClickPress(rightClickPress);
	}
	public boolean isKeyPressed()
	{
		return info.isKeyOnePress();
	}
	public void setKeyPress(boolean keyOnePress)
	{
		info.setKeyOnePress(keyOnePress);
	}
	public boolean getRecord()
	{
		return info.isRecord();
	}
	public void setKey(int keyCode)
	{
		info.setKey(keyCode);
	}
	public int getKey()
	{
		return info.getKey();
	}
	public void setRecord(boolean record)
	{
		info.setRecord(record);
	}
	public int getX()
	{
		return info.getX();
	}
	public void setX(int x)
	{
		info.setX(x);
	}
	public int getX2()
	{
		return info.getX2();
	}
	public void setX2(int x2)
	{
		info.setX2(x2);
	}
	public int getY()
	{
		return info.getY();
	}
	public void setY(int y)
	{
		info.setY(y);
	}
	public int getY2()
	{
		return info.getY2();
	}
	public void setY2(int y2)
	{
		info.setY2(y2);
	}
	public int getTimer()
	{
		return info.getTimer();
	}
	public void setTimer(int ms)
	{
		info.setTimer(ms);
	}
	public boolean getLeftClickRelease()
	{
		return info.isLeftClickRelease();
	}
	public void setLeftClickRelease(boolean leftRelease)
	{
		info.setLeftClickRelease(leftRelease);
	}
	public boolean getRightClickRelease()
	{
		return info.isRightClickRelease();
	}
	public void setRightClickRelease(boolean rightRelease)
	{
		info.setRightClickRelease(rightRelease);
	}
	public boolean getKeyReleased()
	{
		return info.isKeyOneRelease();
	}
	public void setKeyRelease(boolean keyRelease)
	{
		info.setKeyOneRelease(keyRelease);
	}
	public boolean getKeyReleasedTwo()
	{
		return info.isKeyTwoRelease();
	}
	public void setKeyReleaseTwo(boolean keyReleaseTwo)
	{
		info.setKeyTwoRelease(keyReleaseTwo);
	}
/*	public static void main(String[] args)
	{
		info.main(args);
	}
	*/

	@Override
	public void nativeMouseClicked(NativeMouseEvent e) {
		
		
	}

	@Override
	public void nativeMousePressed(NativeMouseEvent e) {
		if(info.isRecord() == true)
		inf.add(info);
		
	}

	@Override
	public void nativeMouseReleased(NativeMouseEvent e) {
		if(info.isRecord() == true)
		inf.add(info);
		//info.setDone(true);
	}

	@Override
	public void nativeMouseDragged(NativeMouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void nativeMouseMoved(NativeMouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowActivated(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowClosed(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowClosing(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowDeactivated(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowDeiconified(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowIconified(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowOpened(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void nativeMouseWheelMoved(NativeMouseWheelEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void nativeKeyPressed(NativeKeyEvent arg0) {
		if(info.isRecord() == true)
			inf.add(info);
		
	}

	@Override
	public void nativeKeyReleased(NativeKeyEvent arg0) {
		if(info.isRecord() == true)
			inf.add(info);
		
	}

	@Override
	public void nativeKeyTyped(NativeKeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}

}